home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / xceedzip / xceedzip.exe / Samples / Zip Manager / Vb5 / frmOptionsColumns.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-04-27  |  8.6 KB  |  214 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "COMCTL32.OCX"
  3. Begin VB.Form frmOptionsColumns 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Column settings"
  6.    ClientHeight    =   4755
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   5790
  10.    ControlBox      =   0   'False
  11.    Icon            =   "frmOptionsColumns.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   4755
  16.    ScaleWidth      =   5790
  17.    ShowInTaskbar   =   0   'False
  18.    StartUpPosition =   1  'CenterOwner
  19.    Begin ComctlLib.ListView lstColCfg 
  20.       Height          =   3615
  21.       Left            =   240
  22.       TabIndex        =   0
  23.       Top             =   360
  24.       Width           =   5295
  25.       _ExtentX        =   9340
  26.       _ExtentY        =   6376
  27.       View            =   3
  28.       LabelEdit       =   1
  29.       MultiSelect     =   -1  'True
  30.       LabelWrap       =   -1  'True
  31.       HideSelection   =   0   'False
  32.       _Version        =   327680
  33.       ForeColor       =   -2147483640
  34.       BackColor       =   -2147483643
  35.       BorderStyle     =   1
  36.       Appearance      =   1
  37.       MouseIcon       =   "frmOptionsColumns.frx":030A
  38.       NumItems        =   2
  39.       BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  40.          Key             =   ""
  41.          Object.Tag             =   ""
  42.          Text            =   "Name"
  43.          Object.Width           =   2822
  44.       EndProperty
  45.       BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  46.          SubItemIndex    =   1
  47.          Key             =   ""
  48.          Object.Tag             =   ""
  49.          Text            =   "Description"
  50.          Object.Width           =   6350
  51.       EndProperty
  52.    End
  53.    Begin VB.Frame frmColConfig 
  54.       Caption         =   "Select the columns to display in the main file list box:"
  55.       BeginProperty Font 
  56.          Name            =   "MS Sans Serif"
  57.          Size            =   8.25
  58.          Charset         =   0
  59.          Weight          =   700
  60.          Underline       =   0   'False
  61.          Italic          =   0   'False
  62.          Strikethrough   =   0   'False
  63.       EndProperty
  64.       Height          =   3975
  65.       Left            =   120
  66.       TabIndex        =   3
  67.       Top             =   120
  68.       Width           =   5535
  69.    End
  70.    Begin VB.CommandButton CmdSettingsCancel 
  71.       Cancel          =   -1  'True
  72.       Caption         =   "&Cancel"
  73.       Height          =   375
  74.       Left            =   4440
  75.       TabIndex        =   2
  76.       Top             =   4265
  77.       Width           =   1215
  78.    End
  79.    Begin VB.CommandButton cmdSettingsOk 
  80.       Caption         =   "&OK"
  81.       Height          =   375
  82.       Left            =   3120
  83.       TabIndex        =   1
  84.       Top             =   4265
  85.       Width           =   1215
  86.    End
  87. Attribute VB_Name = "frmOptionsColumns"
  88. Attribute VB_GlobalNameSpace = False
  89. Attribute VB_Creatable = False
  90. Attribute VB_PredeclaredId = True
  91. Attribute VB_Exposed = False
  92. Option Explicit
  93. '=============================================================================
  94. ' Description: The frmSettingsColumns form gives the user the opportunity to
  95. '              customize which file info columns appear in the main window.
  96. '=============================================================================
  97. 'Two arrays representing the items checkboxes
  98. Dim bColvisible(1 To 12) As Boolean
  99. Dim userChoices(1 To 12) As Boolean
  100. 'Usual counter
  101. Dim counter As Integer
  102. '------------------------------------------------------------------------------------
  103. 'Checks and unchecks the boxes according to the main window's settings.
  104. '------------------------------------------------------------------------------------
  105. Private Sub CheckOrUncheck(xZip As XceedZip)
  106.     For counter = 1 To 12 Step 1
  107.         If bColvisible(counter) Then
  108.             lstColCfg.ListItems.Item(counter).Selected = True
  109.         Else
  110.             lstColCfg.ListItems.Item(counter).Selected = False
  111.         End If
  112.     Next counter
  113. End Sub
  114. '------------------------------------------------------------------------------------
  115. 'Creates the columns on the form
  116. '------------------------------------------------------------------------------------
  117. Private Sub CreateCol(xZip As XceedZip)
  118.     For counter = 1 To 12 Step 1
  119.        If frmMain.lstMain.ColumnHeaders.Item(counter).Width = 0 Then
  120.             bColvisible(counter) = False
  121.             If frmMain.lstMain.ColumnHeaders.Item(counter).Tag = "" Then
  122.                 frmMain.lstMain.ColumnHeaders.Item(counter).Tag = "1500"
  123.             End If
  124.        Else
  125.             bColvisible(counter) = True
  126.             frmMain.lstMain.ColumnHeaders.Item(counter).Tag = Str(frmMain.lstMain.ColumnHeaders.Item(counter).Width)
  127.        End If
  128.     Next counter
  129. End Sub
  130. '------------------------------------------------------------------------------------
  131. ' Loads the items in the listbox
  132. '------------------------------------------------------------------------------------
  133. Private Sub LoadListItems(xZip As XceedZip)
  134.     Dim setting As ListItem
  135.     Set setting = lstColCfg.ListItems.Add(, , "Name")
  136.          setting.SubItems(1) = "The File Name"
  137.        
  138.     Set setting = lstColCfg.ListItems.Add(, , "Comment")
  139.          setting.SubItems(1) = "Comment Inserted with file"
  140.          
  141.     Set setting = lstColCfg.ListItems.Add(, , "Size")
  142.          setting.SubItems(1) = "Size of file"
  143.          
  144.     Set setting = lstColCfg.ListItems.Add(, , "Packed")
  145.          setting.SubItems(1) = "Size of file in the zip file"
  146.          
  147.     Set setting = lstColCfg.ListItems.Add(, , "Attributes")
  148.          setting.SubItems(1) = "File Attributes"
  149.        
  150.     Set setting = lstColCfg.ListItems.Add(, , "CRC")
  151.          setting.SubItems(1) = "Value used to verify integrity of file"
  152.        
  153.     Set setting = lstColCfg.ListItems.Add(, , "Last Modified")
  154.          setting.SubItems(1) = "Date the file was last modified"
  155.     Set setting = lstColCfg.ListItems.Add(, , "Last Accessed")
  156.          setting.SubItems(1) = "Date the file was last accessed"
  157.          
  158.     Set setting = lstColCfg.ListItems.Add(, , "Created")
  159.          setting.SubItems(1) = "Date the file was created"
  160.          
  161.     Set setting = lstColCfg.ListItems.Add(, , "Path")
  162.          setting.SubItems(1) = "Stored Path Name"
  163.          
  164.     Set setting = lstColCfg.ListItems.Add(, , "Method")
  165.          setting.SubItems(1) = "Compression Method"
  166.     Set setting = lstColCfg.ListItems.Add(, , "Encrypted")
  167.          setting.SubItems(1) = "Checks if file is encrypted"
  168. End Sub
  169. '------------------------------------------------------------------------------------
  170. ' Shows the FrmSettingsColumns form to the user
  171. '------------------------------------------------------------------------------------
  172. Public Function ShowForm(xZip As XceedZip) As Boolean
  173.     Tag = "0"
  174.     'Creates the columns on the form
  175.     Call CreateCol(xZip)
  176.     'Loads the main window's columns properties in the list
  177.     Call LoadListItems(xZip)
  178.     'Checks or unchecks the boxes according to the column properties
  179.     Call CheckOrUncheck(xZip)
  180.     ' Shows the window
  181.     Show vbModal
  182.     ' If tag = "1" then the user clicked on ADD and the form's controls
  183.     ' values are copied in the xZip properties
  184.     If Tag = "1" Then
  185.         Call UpdateColSettings(xZip)
  186.     End If
  187.     ShowForm = (frmOptionsColumns.Tag = "1")
  188. End Function
  189. '------------------------------------------------------------------------------------
  190. ' Update the columns on the main window
  191. '------------------------------------------------------------------------------------
  192. Private Sub UpdateColSettings(xZip As XceedZip)
  193.     For counter = 1 To 12 Step 1
  194.        If lstColCfg.ListItems.Item(counter).Selected Then
  195.             frmMain.lstMain.ColumnHeaders.Item(counter).Width = Val(frmMain.lstMain.ColumnHeaders.Item(counter).Tag)
  196.        Else
  197.             frmMain.lstMain.ColumnHeaders.Item(counter).Width = 0
  198.        End If
  199.     Next counter
  200. End Sub
  201. '------------------------------------------------------------------------------------
  202. ' If OK is clicked, tag takes the "1" value
  203. '------------------------------------------------------------------------------------
  204. Private Sub cmdSettingsOk_Click()
  205.     Tag = "1"
  206.     Hide
  207. End Sub
  208. '------------------------------------------------------------------------------------
  209. ' If cancel is pressed, tag stays at "0"
  210. '------------------------------------------------------------------------------------
  211. Private Sub CmdSettingsCancel_Click()
  212.     Hide
  213. End Sub
  214.